Skip to content

Conversation

@ramonberrutti
Copy link

@ramonberrutti ramonberrutti commented May 28, 2025

The change maintains backwards compatibility since the default value is still 1.

Fix #130

New Feature: Configurable Exit Code

  • Global variable added: Introduced globalExitCode as an integer to store the configurable exit code. (main.go, main.goR86)
  • CLI flag added: Added a new --exit-code flag to allow users to specify the exit code when the program terminates. The default value is set to 1. (main.go, main.goR1386-R1390)
  • Signal handling updated: Modified the signal handling logic to use globalExitCode for program termination instead of a hardcoded value. (main.go, main.goL1245-R1247)
  • Flag initialization: Set globalExitCode to the value provided by the --exit-code flag during program initialization. (main.go, main.goR1079)

The change maintains backwards compatibility since the default value is still 1.
Fix minio#130
@jonashartwig
Copy link

jonashartwig commented Jun 10, 2025

This does the trick and will solve our use case as well. Thanks

An enhancement could be to configure the exit code not globally but based on received signal.
e.g. --exitCodeOnSignal 15:0 that on a signal 15 it will exit with 0, any other signal exits on 1. the exitCodeOnSignal should be a multiflag or a list if possible :)

default:
console.Infof("caught signal '%s'\n", signal)
os.Exit(1)
os.Exit(globalExitCode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not so keen to add new flags. I think all what you need to do is to run os.Exit(143) when we receive syscall.SIGTERM. Kubernetes will understand that and will not flag an error for the container

@ramonberrutti
Copy link
Author

Hi Team, going to close as we implemented another solution to route our internal traffic to MinIO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle term signal gracefully

3 participants